<template>
  <div>
    <p>标题<input type="text" v-model="form.title"></p>
    <p>内荣<textarea name="" id="" cols="30" rows="10" v-model="form.content"></textarea> </p>
    <p>
      <button @click="newadd">提交</button>
    </p>
    <br>
    <br>
    <p>图片:<input type="file" id="pic" ></p>
    <p>跳转地址:<input type="text" v-model="jumpaddress"></p>
    <p>类型:<input type="text" v-model="cate"></p>
    <p>
      <button @click="ggadd">提交</button>
    </p>
  </div>
</template>

<script>
export default {
  name: "day0101_addnew",
  data() {
    return {
      form:{},
      cate:'',
      jumpaddress:''
    }
  },
  methods: {
    newadd(){
      this.$axios.post('meiduo01/mnewmanage/',this.form)
      .then(res=>{
        this.$router.push({path:'day0101_newgg'})
      })
    },
    ggadd(){
      let pic = document.getElementById('pic').files[0]
      let Formdata = new FormData
      Formdata.append('picture',pic)
      Formdata.append('jumpaddress',this.jumpaddress)
      Formdata.append('cate',this.cate)
      this.$axios.post('meiduo01/madvertisingmanage/',Formdata)
      .then(res=>{
        this.$router.push({path:'day0101_newgg'})
      })
    }
  },
  mounted() {

  }

}
</script>

<style scoped>

</style>
